package com.example.springbootdemo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.function.Consumer;
import java.util.stream.Collectors;

/**
 * @Author: zhangrongqing
 * @Date: 2020/2/19 15:00
 */
public class LamadaDemo {
    public static void main(String[] args) {
        Map<String,Student> map = new HashMap<String,Student>();
        map.put("test",new Student("test"));
        map.put("test1",null);
        map.put("test2",new Student("test2"));
        System.out.println(map);

        List<String> collect = map.values().stream().filter(Objects::nonNull).map(e -> e.getName()).collect(Collectors.toList());

        System.out.println(collect);

    }

}


@Data
@AllArgsConstructor
@NoArgsConstructor
class Student{

    String name;
}
